package leetcode;

/**
 * @program: datastructureandalogorithm
 * @description:
 * @author: hmx
 * @create: 2022-01-31 18:44
 **/
public class LeetCode1342 {

    public int numberOfSteps(int num) {
        int count = 0;
        while (num != 0) {
            ++count;
            if (num % 2 == 0) {
                num /= 2;
            } else {
                num -= 1;
            }
        }
        return count;
    }

}
